import request from '@/utils/request'

// 获取用户余额
export function getUserBalance() {
  return request({
    url: '/payment/balance',
    method: 'get'
  })
}

// 获取充值记录
export function getPaymentRecords() {
  return request({
    url: '/payment/payments',
    method: 'get'
  })
}

// 获取消费记录
export function getTransactionRecords() {
  return request({
    url: '/payment/transactions',
    method: 'get'
  })
}

// 创建充值订单
export function createRechargeOrder(data) {
  return request({
    url: '/payment/recharge',
    method: 'post',
    data
  })
}

// 获取虚拟币充值套餐
export function getVirtualCoinPackages() {
  return request({
    url: '/payment/packages',
    method: 'get'
  })
}

// 创建支付订单
export function createPaymentOrder(data) {
  return request({
    url: '/payment',
    method: 'post',
    data
  })
}

// 查询支付状态
export function getPaymentStatus(orderId) {
  return request({
    url: `/payment/${orderId}`,
    method: 'get'
  })
}

// 创建支付
export function createPayment(data) {
  return request({
    url: '/payment/create',
    method: 'post',
    data
  })
}

// 查询支付状态
export function queryPaymentStatus(paymentId) {
  return request({
    url: `/payment/status/${paymentId}`,
    method: 'get'
  })
}

// 获取支付历史记录
export function getPaymentHistory(params) {
  return request({
    url: '/payment/history',
    method: 'get',
    params
  })
}